feat(forward): collect per-rule metrics and interfaces#692
Closed
feat(forward): collect per-rule metrics and interfaces#692
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the forward control-plane to expose metrics via gRPC and refactors the controlplane FFI DPConfig surface toward interfaces, while adding a new NIC counters retrieval path that wires through the C agent/Go FFI.
Changes:
- Add
ForwardService.GetMetricsRPC and a forward metrics collector. - Introduce FFI interfaces (
FFIAgent,DPConfig, etc.) and adjust call sites to use interface-based DPConfig handles. - Add NIC counters plumbing (dataplane worker-side NIC stat export + controlplane agent/FFI APIs to fetch NIC counters).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/forward/controlplane/service.go | Adds GetMetrics gRPC handler calling forward metric collection. |
| modules/forward/controlplane/metrics.go | New forward metrics collector (currently using wrong module type / filtering). |
| modules/forward/controlplane/service_test.go | Updates mock backend for new Backend.Agent() method (currently doesn’t compile). |
| modules/forward/controlplane/forwardpb/forward.proto | Adds GetMetrics RPC and Metric proto dependency. |
| modules/forward/controlplane/backend.go | Exposes underlying FFI agent via Backend.Agent(). |
| controlplane/ffi/shm.go | Introduces DPConfig/agent interface types; DPConfig now returned as an interface; adds NicCounters. |
| controlplane/ffi/agent.go | Introduces FFIAgent interfaces and updates Agent.DPConfig() to return the interface type. |
| controlplane/internal/gateway/inspect_service.go | Updates helper signatures to accept ffi.DPConfig interface instead of pointer. |
| modules/balancer/agent/go/ffi/agent.go | Updates DPConfig() return type to the new interface type. |
| controlplane/ynpb/counters.proto | Adds Nic RPC and request message (server handler not implemented). |
| api/counter.h | Declares new yanet_get_nic_counters C API. |
| lib/controlplane/config/zone.h | Adds cp_config_gen_get_nic_counter_storage alias (currently mapped to device storage). |
| lib/controlplane/agent/agent.c | Implements yanet_get_nic_counters (currently returns malformed lists when filtered). |
| lib/dataplane/config/zone.h | Extends dp_worker with NIC counter pointers. |
| dataplane/worker.c | Adds periodic NIC stats sampling and registers new worker counters; refactors worker counter wiring. |
| dataplane/dataplane.c | Comments out legacy rte_eth_stats logging in stat_thread. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+198
to
+202
| func (m *ForwardService) GetMetrics( | ||
| ctx context.Context, | ||
| req *forwardpb.GetMetricsRequest, | ||
| ) (*forwardpb.GetMetricsResponse, error) { | ||
| m.mu.Lock() |
Comment on lines
+29
to
+32
| func (m *ForwardService) collectMetrics() ([]*commonpb.Metric, error) { | ||
| dpConfig := m.backend.Agent().DPConfig() | ||
| positions := dpConfig.AllModulePositions("acl") | ||
|
|
Collaborator
Author
|
reopen 694 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.